import 'package:mobile_app.core/core/domain/entities/learning_content/lexical_item/lexical_item.dart';
import 'package:mobile_app.home.core/core/presentation/models/lexical_item_progress_model/lexical_item_progress_model.dart';

class LexicalItemProgressModelFactory {
  const LexicalItemProgressModelFactory._internal();

  static const _instance = LexicalItemProgressModelFactory._internal();

  factory LexicalItemProgressModelFactory() {
    return _instance;
  }

  LexicalItemProgressModel create({
    required LexicalItem lexicalItem,
    required int progressPercent,
  }) {
    if (lexicalItem.excluded) {
      return const ExcludedLexicalItemProgressModel();
    }

    final progress = lexicalItem.progress;

    switch (progress) {
      case null:
        return const UnspecifiedLexicalItemProgressModel();
      case PreviouslyKnownLexicalItemProgress():
        return const PreviouslyKnownLexicalItemProgressModel();
      case LearningLexicalItemProgress():
        return LearningLexicalItemProgressModel(
          progressPercent: progressPercent,
        );
    }
  }
}
